import { createRouter, createWebHistory } from "vue-router";
import LoginComponent from "../components/LoginComponent.vue";
import UserComponent from "../components/UserComponent.vue";
import UserMenuList from "../components/UserMenuList.vue";
import UserAppointment from "../components/UserAppointment.vue";
import UserPayment from "../components/UserPayment.vue";
import UserMyAppointments from "../components/UserMyAppointments.vue";
import UserCheckRecord from "../components/UserCheckRecord.vue";
import UserWaiting from "../components/UserWaiting.vue";
const routes = [
  {
    path: "/",
    name: "Login",
    component: LoginComponent,
  },
  {
    path: "/user",
    name: "UserComponent",
    component: UserComponent,
    redirect: "/user/UserMenuList",
    children: [
      {
        path: "UserMenuList",
        name: "UserMenuList",
        component: UserMenuList,
      },
      {
        path: "UserAppointment",
        name: "UserAppointment",
        component: UserAppointment,
      },
      {
        path: "UserPayment",
        name: "UserPayment",
        component: UserPayment,
      },
      {
        path: "UserMyAppointments",
        name: "UserMyAppointments",
        component: UserMyAppointments,
      },
      {
        path: "check-record/:id",
        name: "UserCheckRecord",
        component: UserCheckRecord,
        props: true, // 允许将路由参数作为组件的 props
      },
      {
        path: "UserWaiting/:id",
        name: "UserWaiting",
        component: UserWaiting,
        props: true, // 允许将路由参数作为组件的 props
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
